#include <string.h>
#include "CRC32.h"

unsigned long calculateCRC32(char* bytes, unsigned long bufferSize)
{
    unsigned long crc;
    int c;
    crc = 0xFFFFFFFF;
    if (bytes && (bufferSize > 0))
    {
        while (bufferSize--)
        {
            c = *bytes;
            crc = ((crc >> 8) & 0x00FFFFFF) ^ crcTable[ (crc^c) & 0xFF ];
            bytes++;
        }
    }
    return ( crc^0xFFFFFFFF);
}

